﻿<UserControl x:Class="ViewTrvNavig"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2006"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:TxGar="clr-namespace:TauxGaranti"
             xmlns:ViewModel="clr-namespace:TauxGaranti.ViewModels"
             DataContext="{Binding Source={x:Static ViewModel:Locator.ViewModeleMainWindowStatic}}"
             mc:Ignorable="d">
    
    <DockPanel Grid.Row="0"  Margin="5,0,0,0" >
        <Label Style="{DynamicResource OMANE_labelTitre}" DockPanel.Dock="Top">
            Arborescence
        </Label>
        <TreeView BorderThickness="1,0,1,1" 
                  Style="{DynamicResource trv}" 
                  Name="trvOMANE"
                  ItemsSource="{Binding CommandsNavig}"
                  ItemContainerStyle="{StaticResource trvFeuille}">
            
            <TreeView.Resources>
                
                <!--Template des éléments ne possédant pas de noeud enfant-->
                <DataTemplate DataType="{x:Type ViewModel:ViewModelCommand}">
                    <StackPanel Orientation="Horizontal">
                        <Image Source="{Binding Converter={StaticResource CommandToIconConverter} }" ></Image>
                        <TextBlock Margin="5,0,0,0">
                            <Hyperlink Command="{Binding Command}" CommandParameter="{Binding DisplayName}">
                                <Hyperlink.Style>
                                    <Style TargetType="Hyperlink" BasedOn="{StaticResource {x:Type Hyperlink}}">
                                        <Setter Property="Foreground">
                                            <Setter.Value>
                                                <SolidColorBrush Color="{StaticResource CoulTabControlItemNoeudEnfantForeground}" />                                                    
                                            </Setter.Value>
                                        </Setter>
                                    </Style>
                                </Hyperlink.Style>
                                <TextBlock Text="{Binding DisplayName}"></TextBlock>                            
                            </Hyperlink>
                        </TextBlock>
                    </StackPanel>
                </DataTemplate>
                
                <!--Template des éléments possédant un noeud enfant-->
                <HierarchicalDataTemplate DataType="{x:Type ViewModel:ViewModelCommandGroup}" 
                                          ItemsSource="{Binding ViewModelCommandChilds}">
                    <StackPanel Orientation="Horizontal">
                        <Image Source="{Binding Converter={StaticResource CommandToIconConverter} }" ></Image>
                        <Label Content="{Binding DisplayName}"></Label>
                    </StackPanel>
                </HierarchicalDataTemplate>
                
            </TreeView.Resources>
            <!--<ScrollViewer RenderTransformOrigin="0.5,0.5" HorizontalAlignment="Stretch" Width="Auto" HorizontalScrollBarVisibility="Visible">
            </ScrollViewer>-->
        </TreeView>
    </DockPanel>
</UserControl>